package algorithm;

import java.util.Arrays;

class Solution {
    public static int findGCD(int[] nums) {
        Arrays.sort(nums);
        return my_gcd(nums[0], nums[nums.length - 1]);
    }

    public static int my_gcd(int a, int b) {
        while (b > 0) {
            int tmp = a % b;
            System.out.println("a="+a+",b="+b+",tmp="+tmp);
            a = b;
            b = tmp;
        }
        return a;
    }

    public static void main(String[] args) {
        System.out.println(findGCD(new int[]{10,2}));
    }
}